package com.yyj.dao;

import com.yyj.entity.Admin;
import com.yyj.entity.Params;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminDao {
    /*@Select("select * from admin")*/
    List<Admin> getAdmin();

    List<Admin> getBySearch(@Param("params") Params params);

    @Insert("insert into admin (name,password,sex,age,phone) values (#{name },'123456',#{sex},#{age},#{phone})")
    void insertAdmin(Admin admin);

    @Update("update admin set name=#{name},password=#{password},sex=#{sex},age=#{age},phone=#{phone} where id=#{id}")
    void updateAdmin(Admin admin);

    @Delete("DELETE FROM admin WHERE id = #{id}")
    void deleteByPrimaryKey(Integer id);

    @Select("select * from admin where name=#{name} and password=#{password}")
    Admin login(Admin admin);

    @Select("select * from admin where name=#{name}")
    Admin selectByName(@Param("name") String name);

    @Select("select * from admin where id=#{id}")
    Admin findById(Integer id);
}
